package com.whisper.application.app.web.controller.front;

import com.whisper.application.service.domain.VrAct;
import com.whisper.application.service.domain.VrApply;
import com.whisper.application.service.service.IVrActService;
import com.whisper.application.service.service.IVrApplyService;
import com.whisper.common.core.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 前台用户信息Controller
 * 
 * @author whisper
 * @date 2024-01-07
 */
@RestController
@RequestMapping("/front/act")
public class FrontActController extends BaseController
{
    @Autowired
    private IVrApplyService applyService;

    @Autowired
    private IVrActService actService;

    @GetMapping("/apply/{id}")
    public List<VrAct> getUserAttendAct(@PathVariable("id") Long id) throws Exception
    {
        VrApply apply = new VrApply();
        apply.setuId(id);
        apply.setStatus("1");
        List<Long> collect = applyService.selectVrApplyList(apply).stream().map(VrApply::getActId).collect(Collectors.toList());
        return actService.selectVrActBatchIds(collect);
    }

}
